package io.zhengsh.order.exception;

import java.util.Optional;

public class ServiceException extends RuntimeException {
    private int code;

    public ServiceException(String message) {
        this(500, message);
    }

    public ServiceException(Integer code, String message) {
        super(message);
        this.code = Optional.ofNullable(code).orElse(500);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
